 const setAuthorization = function (type) {
   let cookie = '';
   switch (type) {
     case 'user':
       cookie = '5c9dbdbc1c3f4a3271098eeca429f3ec147794396a2054de198215c5cffc25cb9465039ad41ebf238Am3Qb18XFP56a80387501sggWDv6J90ib8H809f431N15KU73C39gfq0VwkiC2wa702k4m241advWIOCb3412209hk17847i66853l56780Fwko47Z3c7ec91eb714ebd71712b1fcb87fc679e361352N3906996x03V9Mt61wAx80';
       break;
     case 'hr':
       cookie = '6103d743eb52e9305c8b821975d89909f00ce7749ec54fe303d2e8b621758388e1d0b62d868dc2eegz6t4K65F9f1g2636c57JCuKundeW18YS89xh1V13h5u39p99V9b24940StKcIX58eK7wjTSUL1R42QazDBY575TH17wHv62i3096D43oey0Z8Kn7w551a9a4ff9791e8b448f9c0f0ea15382906HtKlf4v8u85mIh6vi788o9Ck880';
       break;
     case 'delegator':
       cookie = '6103d743eb52e9305c8b821975d89909f00ce7749ec54fe303d2e8b621758388e1d0b62d868dc2eegz6t4K65F9f1g2636c57JCuKundeW18YS89xh1V13h5u39p99V9b24940StKcIX58eK7wjTSUL1R42QazDBY575TH17wHv62i3096D43oey0Z8Kn7w551a9a4ff9791e8b448f9c0f0ea15382906HtKlf4v8u85mIh6vi788o9Ck880';
       break;
     case 'manage':
       cookie = '6b4a3460149cccd301a7f942d297407e17f3f28aa365ad182a0ecb8b3db6351ac7ddabcee8e280eeX6noSgJ3PzOq6zzY850894j522es07C795Z1GC1MXLM18349J5Y17bH54co8Hl51Lo6z7a4bhD022U1qW06p0969l3L030Q27bhp8E57z65c8j4Q3Wp2a46f7eae5dce14c62ff1a5bc8eb2e25f0052w24L02u31Q4131F0xh6y7080';
       break;
     default:
       cookie = '5c9dbdbc1c3f4a3271098eeca429f3ec147794396a2054de198215c5cffc25cb9465039ad41ebf238Am3Qb18XFP56a80387501sggWDv6J90ib8H809f431N15KU73C39gfq0VwkiC2wa702k4m241advWIOCb3412209hk17847i66853l56780Fwko47Z3c7ec91eb714ebd71712b1fcb87fc679e361352N3906996x03V9Mt61wAx80';
       break;
   }
   return cookie;
 }
 // const users = {
 //   'admin-token': {
 //     roles: ['admin'],
 //     introduction: 'I am a super administrator',
 //     avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
 //     name: 'Super Admin'
 //   },
 //   'editor-token': {
 //     roles: ['editor'],
 //     introduction: 'I am an editor',
 //     avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
 //     name: 'Normal Editor'
 //   }
 // }

 const users = ['admin', 'fxj'];


 module.exports = [
   // user login
   {
     url: '/vue-admin-template/user/login',
     type: 'post',
     response: config => {
       const {
         username,
         password
       } = config.body
       const index = users.findIndex(u => u === username);
       if (index < 0)
         return {
           code: 60204,
           message: '用户名不存在'
         }
       if (password != '1') {
         return {
           code: 60204,
           message: '密码错误'
         }
       }
       const token = {
         token: setAuthorization(username)
       }
       return {
         code: 20000,
         data: token
       }
     }
   },

   // get user info
   {
     url: '/vue-admin-template/user/info\.*',
     type: 'get',
     response: config => {
       const {
         token
       } = config.query
       const info = {
        name:'admin'
       }
       return {
         code: 20000,
         data: info
       }
     }
   },

   // user logout
   {
     url: '/vue-admin-template/user/logout',
     type: 'post',
     response: _ => {
       return {
         code: 20000,
         data: 'success'
       }
     }
   }
 ]
